package org.elzat.healthboxgatewayapp.repository;

import org.elzat.healthboxgatewayapp.dto.HealthBoxUserEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Optional;

@Component
public interface HealthBoxUserRepository extends JpaRepository<HealthBoxUserEntity, Long> {

    Optional<HealthBoxUserEntity> findByUserPhone(String userPhone);
    Optional<HealthBoxUserEntity> findByIdNumber(String idNumber);
    Optional<HealthBoxUserEntity> findByUserPhoneAndIdNumber(String userPhone, String idNumber);
    List<HealthBoxUserEntity> findAllByRole(String role);
    Optional<HealthBoxUserEntity> findByUserPhoneAndRole(String userPhone, String role);
    Optional<HealthBoxUserEntity> findByIdNumberAndRole(String idNumber, String role);

    Boolean existsByUserPhone(String userPhone);

    Boolean existsByIdNumber(String idNumber);
}
